import Mock from 'mockjs'
Mock.mock('http://localhost:8081/permission/centre/v1/loginStatistics', 'get', (config) => {
  // 需要注意返回的 json 格式数据
  // const obj = JSON.parse(config.body)
  // 判断用户名密码
  return {
    head: {

    },
    body: {
      LoginStatistics: [
        { time: 0, value: 100 },
        { time: 3, value: 110 },
        { time: 6, value: 720 },
        { time: 9, value: 230 },
        { time: 12, value: 140 },
        { time: 15, value: 420 },
        { time: 18, value: 550 },
        { time: 21, value: 420 },
        { time: 24, value: 100 }
      ]
    }

  }
})
// 脚手架会通过babel降级语法，js使用需要使用commonjs语法
// const Mock = require('mockjs')

// /v1/onlineStatistics
Mock.mock('http://localhost:8081/permission/centre/v1/onlineStatistics', 'get', (config) => {
  return {
    head: {

    },
    body: {
      OnlineStatistics: [
        { time: 0, value: 100 },
        { time: 3, value: 110 },
        { time: 6, value: 320 },
        { time: 9, value: 230 },
        { time: 12, value: 540 },
        { time: 15, value: 420 },
        { time: 18, value: 650 },
        { time: 21, value: 220 },
        { time: 24, value: 100 }
      ]
    }

  }
})

Mock.mock('http://localhost:8081/permission/centre/v1/methinelnfo', 'get', config => {
  return {
    head: {

    },
    body: {
      MethineInfovo: [
        {
          'ip': '172.18.164.209',
          'children': [
            {
              '指标1': 'cpu',
              '当前值': '78%',
              'info': '8核3.5HZ'
            },
            {
              '指标2': 'memory',
              '当前值': '20%',
              'info': '1T'
            },
            {
              '指标3': 'disk',
              '当前值': '60%',
              'info': '128T'
            }
          ]
        },
        {
          'ip': '172.18.164.210',
          'children': [
            {
              '指标1': 'cpu',
              '当前值': '52%',
              'info': '4核3.5HZ'
            },
            {
              '指标2': 'memory',
              '当前值': '33%',
              'info': '1T'
            },
            {
              '指标3': 'disk',
              '当前值': '49%',
              'info': '128T'
            }
          ]
        },
        {
          'ip': '172.18.164.211',
          'children': [
            {
              '指标1': 'cpu',
              '当前值': '11%',
              'info': '16核3.5HZ'
            },
            {
              '指标2': 'memory',
              '当前值': '27%',
              'info': '1T'
            },
            {
              '指标3': 'disk',
              '当前值': '89%',
              'info': '256T'
            }
          ]
        }
      ]

    }

  }
})
